//定义记分牌
export class ScorePanel{
    score:number = 0;//分数
    level = 1;//等级
    scoreEle:HTMLElement;
    levelEle:HTMLElement;
    //限制等级
    maxLevel:number;
    upScore:number
    constructor(maxLevel:number = 10,upScore:number = 10){
        this.scoreEle = document.querySelector('.score')!
        this.levelEle = document.querySelector('.level')!
        this.maxLevel = maxLevel
        this.upScore = upScore
    }
    //加分
    addScore(){
        // this.score ++;
        this.scoreEle.innerHTML = ++this.score + '';
        if(this.score % this.upScore === 0) this.levelUp();
    }
    //升级
    levelUp(){
        if(this.level < this.maxLevel)
        this.levelEle.innerHTML = ++this.level + ''
    }
}
/* const scorePanel = new ScorePanel()
scorePanel.addScore() */
